/////////////////////////////////////////////////////////////////////////////
//
// (c) 2007 BinaryComponents Ltd.  All Rights Reserved.
//
// http://www.binarycomponents.com/
//
/////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;

namespace SuperListEx
{
	public abstract class RowIdentifier
    {
        #region Properties
        public virtual Column LastColumn
		{
			get
			{
				return GroupColumns.Count > 0 ? GroupColumns[GroupColumns.Count - 1] : null;
			}
        }

        public virtual List<Column> GroupColumns
        {
            get;
            protected set;
        }

        public virtual List<object> GroupValues
        {
            get;
            protected set;
        }

        public object LastGroupValue
        {
            get
            {
                return GroupValues.Count == 0 ? null : GroupValues[GroupValues.Count - 1];
            }
        }

        public virtual List<object> Items
        {
            get;
            protected set;
        }

        public abstract int ItemCount
        {
            get;
        }
        #endregion

        #region operator overloads
        public static bool operator ==( RowIdentifier lhs, RowIdentifier rhs )
		{
			if( Equals( lhs, rhs ) )
			{
				return true;
			}
            if (Equals(lhs, null))
			{
				return false;
			}
            if (Equals(rhs, null))
			{
				return false;
			}

			return lhs.Equals( rhs );
		}

		public static bool operator !=( RowIdentifier lhs, RowIdentifier rhs )
		{
			return !(lhs == rhs);
        }
        #endregion

        public override bool Equals( object obj )
		{
            return Equals(this, obj);
		}
	}
}